package cn.wolfcode.luowowo.search.template;

import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;
import java.util.List;

@Setter@Getter
@Document(indexName="luowowo_answer",type="answer")
public class AnswerTemplate {
    //@Field 每个文档的字段配置（类型、是否分词、是否存储、分词器 ）
    @Id
    @Field(store = true, index = true, type = FieldType.Long)
    private Long id;  //游记id
    @Field(index=true,analyzer="ik_max_word",store=true,searchAnalyzer="ik_max_word",type = FieldType.Text)
    private String title; //游记地点名称
    @Field(store=true, index = true,type = FieldType.Long)
    private Long destId;  //目的地id
    @Field(index=true,store=true,type = FieldType.Keyword)
    private String detailName; //目的地名称
    @Field(store=true, index = true,type = FieldType.Long)
    private Long userId;    //用户id
    @Field(index=true,store=true,type = FieldType.Keyword)
    private String nickname;  //用户名
    @Field(index=true,store=true,type = FieldType.Keyword)
    private String city; //用户所在城市
    //        private int level;   //级别
    @Field(index=true,store=true,type = FieldType.Keyword)
    private String headImgUrl;     //头像
    @Field(pattern = "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis", type=FieldType.Date, format = DateFormat.custom)
    private Date crateTime;    //创建时间
    @Field(index=true,analyzer="ik_max_word",store=true,searchAnalyzer="ik_max_word",type = FieldType.Text)
    private String context;      //评论内容
    @Field(store=true, index = true,type = FieldType.Long)
    private Long  titleId;//回答问题的id
    @Field(index=true,analyzer="ik_max_word",store=true,searchAnalyzer="ik_max_word",type = FieldType.Text)
    private List<String> aswerTag;//标签集合
    @Field(store = true, index = true, type = FieldType.Integer)
    private int top=0;//顶数量
    @Field(store = true, index = true, type = FieldType.Integer)
    private int remark=0;//评论信息
    @Field(store = true, index = true, type = FieldType.Integer)
    private int read=0;//浏览数量
    @Field(index=true,store=true,type = FieldType.Keyword)
    private String coverUrl;
    @Field(index=true,analyzer="ik_max_word",store=true,searchAnalyzer="ik_max_word",type = FieldType.Text)
    private String content;//详细回答内容
    @Field(store = true, index = true, type = FieldType.Integer)
    private Long vserion;// 1:最新回答 2：回答明细

}
